#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "file.h"

const char* led_path = "/sys/class/leds/led1/brightness";

int main()
{
    while (1)
    {
        //开灯
        write_file(led_path, "1");
        sleep(1);

        float status;
        read_file(led_path, &status);
        printf("%s: %.0f\n", led_path, status);

        //关灯
        write_file(led_path, "0");
        sleep(1);
        read_file(led_path, &status);
        printf("%s: %.0f\n", led_path, status);
    }

    return EXIT_SUCCESS;
}
